package interview_questions;

import java.util.Scanner;

public class Main1_3 {
	public static boolean canExchange(String s1, String s2) {
		if(s1.length() != s2.length()) return false;
		int[] char_set = new int[256];
		for(int i = 0; i < s2.length(); i++) {
			int val = s2.charAt(i);
			char_set[val]++;
		}
		for(int i = 0; i < s1.length(); i++) {
			int val = s1.charAt(i);
			if(--char_set[val] < 0)
				return false;
		}
		return true;
	}
	
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String s1 = in.next();
		String s2 = in.next();
		System.out.println(canExchange(s1, s2));
		in.close();
	}

}
